package com.designPattern.proxy.staticproxy;

/**
 * 代理类
 */
public class ProxyTeacherDao implements ITeacherDao{
    //聚合一个需要增强的类
    ITeacherDao teacherDao = null;
    //通过构造方法传入需要被代理的对象
    public ProxyTeacherDao(ITeacherDao teacherDao){
        this.teacherDao = teacherDao;
    }
    //增强被代理类的方法
    @Override
    public void teach() {
        System.out.println("before the class....");
        //调用需要被增强的的方法
        teacherDao.teach();
        System.out.println("teacher leaves");
    }
}
